package com.bibrApp.difu.fragment.send_mvp;

import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;


//记录解决edittext数据刷新的问题
public class AddTypeNameWatcher implements TextWatcher {


    private SendBean mData;
    private int mType;//0 地址 1 金额

    public AddTypeNameWatcher(SendBean data ,int type) {
        mData = data;
        mType = type;
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        String s = charSequence.toString().replaceAll(" ","");
        if(!TextUtils.isEmpty(s)){
            if (mType == 0) {
                mData.setAddress(s);
            } else {
                mData.setNum(s);
            }
        }
    }

    @Override
    public void afterTextChanged(Editable editable) {

    }
}